﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>
<% 
if sid="Null" then 
Response.Redirect "/login.asp?sid="&sidd&"&url=/user/addfans.asp?sid="&sidd&"@@fansid="&Request.QueryString("fansid")
end if
	IF  Request.QueryString("act")="pay1" Then
		call pay1
	elseIF  Request.QueryString("act")="pay2" Then
		call pay2
	else
		call pay
	end if
end Function

sub pay
select case v
case "0" 
we0="<br/>"
title="<card id=""login"" title=""我的好友""  ontimer=""/login.asp?sid="&sidd&"&url=/user/fans.asp?sid="&sidd&"""><timer value='30'/><p align="""&qingtian.px&""">"
title1="<card title=""添加好友""  ontimer=""fans.asp?sid="&sidd&"""><timer value='30'/><p align="""&qingtian.px&""">"
title2="<card title=""删除好友""  ontimer=""fans.asp?sid="&sidd&"""><timer value='30'/><p align="""&qingtian.px&""">"
title3="<card title=""清空好友""><p align="""&qingtian.px&""">"
case "1"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
title="<title>我的好友</title></head><body>"
title1="<title>添加好友</title></head><body>"
title2="<title>删除好友</title></head><body>"
title3="<title>清空好友</title></head><body>"
End Select
	dim rs,sql,urls,strr
	urls=Request.QueryString("urls")
	if urls="" then urls="index.asp"


	dim fansid
		fansid=Request.QueryString("fansid")
		if not isnumeric(fansid) then fansid=0
		if fansid="" then fansid=0
		fansid=clng(fansid)

%>
<%=title1%>
<%
qingtian.info
if fansid=qingtian.nid then qingtian.err("不能将自己加为好友!")
		if fansid<>0 then

			set rs=Server.CreateObject("Adodb.Recordset")
			rs.open "select fansid,nid from qingtian_fans where fansid="&fansid&" and nid=(select top 1 id from qingtian_user where sid='"&qingtian.Formatsid(sid)&"')",conn,1,3
			if rs.bof and rs.eof then
			rs.addnew()	
			rs("fansid")=fansid
			rs("nid")=qingtian.nid
			rs.update
strr=""&fansid&"tt你好,(url=/user/spacev.asp?nid="&qingtian.nid&"&sid=[sid])"&session("username")&"(/url)已经将你加为好友![br]是否同意他成为你的朋友:(url=/user/addfans.asp?fansid="&qingtian.nid&"&urls=/user/ininfo.asp&sid=[sid])是(/url),(url=/user/spacev.asp?nid="&qingtian.nid&"&sid=[sid])否(/url)"
qingtian.addnfo(strr)
qingtian.addong("将[url=/user/spacev.asp?nid="&fansid&"&sid=[sid]]"&qingtian.name(fansid)&"[/url]添加为好友")
%><%=we%>恭喜你,你已成功添加好友。<br/>
<%
			else
			%><%=we%>添加好友出错,你已经加对方为好友了。<br/>
<%
			end if
			Rs.close
			set rs=nothing
		%>
		<a href="<%=qingtian.backurl(urls)%>">返回来源页</a>
<%=we0%><%=qingtian.qingsav("90")%><%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="index.asp?sid=<%=sidd%>">地盘</a><%=we0%>

		<%
		else
		%>
		<%=we%>添加好友出错,好友ID不能为空!<br/>
		<a href="<%=qingtian.backurl(urls)%>">返回来源页</a><%=we0%><%=qingtian.qingsav("90")%><%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="index.asp?sid=<%=sidd%>">地盘</a><%=we0%>
		<%
		end if


end sub


sub pay1
	dim rs,sql,urls,id
	urls=Request.QueryString("urls")
	if urls="" then urls="index.asp"


		id=Request.QueryString("id")
		if not isnumeric(id) then id=0
		if id="" then id=0
		id=clng(id)
select case v
case "0" 
we0="<br/>"
title="<card id=""login"" title=""我的好友""  ontimer=""/login.asp?sid="&sidd&"&url=/user/fans.asp?sid="&sidd&"""><timer value='30'/><p align="""&qingtian.px&""">"
title1="<card title=""添加好友""  ontimer=""fans.asp?sid="&sidd&"""><timer value='30'/><p align="""&qingtian.px&""">"
title2="<card title=""删除好友""  ontimer=""fans.asp?sid="&sidd&"""><timer value='30'/><p align="""&qingtian.px&""">"
title3="<card title=""清空好友""><p align="""&qingtian.px&""">"
case "1"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
title="<title>我的好友</title></head><body>"
title1="<title>添加好友</title></head><body>"
title2="<title>删除好友</title></head><body>"
title3="<title>清空好友</title></head><body>"
End Select


%>
<%=title2%>
<%
qingtian.info

			set rs=Server.CreateObject("Adodb.Recordset")
			rs.open "select id from qingtian_fans where id="&id&" and [nid]=(select top 1 id from qingtian_user where sid='"&qingtian.Formatsid(sid)&"')" ,conn,1,3
			if not (rs.bof and rs.eof) then
			rs.delete
			end if
			Rs.close
			set rs=nothing
%>

			<%=we%>删除好友成功。<br/><a href="<%=qingtian.backurl(urls)%>">返回来源页</a><%=we0%><%=qingtian.qingsav("90")%><%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="index.asp?sid=<%=sidd%>">地盘</a><%=we0%>
	
<%
end sub

sub pay2
select case v
case "0" 
we0="<br/>"
title="<card id=""login"" title=""我的好友""  ontimer=""/login.asp?sid="&sidd&"&url=/user/fans.asp?sid="&sidd&"""><timer value='30'/><p align="""&qingtian.px&""">"
title1="<card title=""添加好友""  ontimer=""fans.asp?sid="&sidd&"""><timer value='30'/><p align="""&qingtian.px&""">"
title2="<card title=""删除好友""  ontimer=""fans.asp?sid="&sidd&"""><timer value='30'/><p align="""&qingtian.px&""">"
title3="<card title=""清空好友""><p align="""&qingtian.px&""">"
case "1"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
title="<title>我的好友</title></head><body>"
title1="<title>添加好友</title></head><body>"
title2="<title>删除好友</title></head><body>"
title3="<title>清空好友</title></head><body>"
End Select
	dim rs,sql,urls,i,t
	urls=Request.QueryString("urls")
	if urls="" then urls="index.asp"


		T=Trim(Request("T"))
		if T<>"" then
			%>
<%=title3%>
			<%
			qingtian.info

			Set Rs = Server.CreateObject("Adodb.Recordset")
			Sql = "select id from qingtian_fans where [nid]=(select top 1 id from qingtian_user where sid='"&qingtian.Formatsid(sid)&"')"
			Rs.Open Sql,conn,1,3
			if not (rs.bof and rs.eof)  then
				For i=1 to rs.RecordCount
					If Rs.Eof Then
						exit For
					End If

					rs.delete
					Rs.MoveNext
				Next

			end if
			Rs.close
			set rs=nothing
%>

			<%=we%>清空好友列表成功。<br/><a href="<%=qingtian.backurl(urls)%>">返回来源页</a><%=we0%><%=qingtian.qingsav("90")%><%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="index.asp?sid=<%=sidd%>">地盘</a><%=we0%>
		<%else%>
<%=title3%>
			<%qingtian.info%>
			<%=we%>确定要清空好友列表吗？<br/>
			<a href="addfans.asp?act=pay2&amp;T=true&amp;sid=<%=sidd%>&amp;urls=<%=urls%>">确定清空</a>|<a href="fans.asp?sid=<%=sidd%>&amp;urls=<%=urls%>">我按错了</a><br/><a href="<%=qingtian.backurl(urls)%>">返回来源页</a><%=we0%><%=qingtian.qingsav("90")%><%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="index.asp?sid=<%=sidd%>">地盘</a><%=we0%>
		<%end if%>
		<%


end sub%>
